<!DOCTYPE html>
<html lang="en-US">
    <head>
        <title>File::Copy::Recursive - Perl extension for recursively copying files and directories - metacpan.org</title>
        <link rel="preload" as="fetch" href="https://metacpan.org/account/login_status" crossorigin="anonymous" />
        <link href="https://metacpan.org/_assets/b8ccceeed47a0652049703d99326a9cea4933443.css" rel="stylesheet" type="text/css">
        <script src="https://metacpan.org/_assets/6bfedafe2d7caa915b7d84f61b45936818e3242e.js" type="text/javascript" defer></script>
        <link rel="alternate" type="application/rss+xml" title="Recent CPAN Uploads of File-Copy-Recursive - MetaCPAN" href="https://metacpan.org/dist/File-Copy-Recursive/releases.rss" />
        <link rel="canonical" href="./File::Copy::Recursive.html" />
        <meta name="description" content="Perl extension for recursively copying files and directories" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
        <link rel="shortcut icon" href="https://metacpan.org/static/icons/favicon.ico">
        <link rel="apple-touch-icon" sizes="152x152" href="https://metacpan.org/static/icons/apple-touch-icon.png">
        <link rel="search" href="https://metacpan.org/static/opensearch.xml" type="application/opensearchdescription+xml" title="MetaCPAN">
        <script>
          (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
          (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
          })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

          (function(skey, ga_id){
            ga('create', ga_id, {
              siteSpeedSampleRate : 100,
              storage             : 'none',
              clientId            : localStorage.getItem(skey)
            });
            ga(function(tracker) {
              localStorage.setItem(skey, tracker.get('clientId'));
            });
            ga('send', 'pageview');
          })('ga:clientId', 'UA-27829474-1');
        </script>
<meta name="twitter:card"        content="summary" />
<meta name="twitter:url"         content="https://metacpan.org/pod/File::Copy::Recursive" />
<meta name="twitter:title"       content="File::Copy::Recursive" />
<meta name="twitter:description" content="Perl extension for recursively copying files and directories" />
<meta name="twitter:site"        content="metacpan" />
    </head>
    <body>
        <nav class="navbar navbar-default" role="navigation">
            <div class="header-logo-large hidden-xs">
              <a href="https://metacpan.org/" tabindex="0">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#logo" />
                </svg>
              </a>
            </div>
            <div class="header-logo-icon visible-xs">
              <a href="https://metacpan.org/">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#dots" />
                </svg>
              </a>
            </div>
            <ul class="nav navbar-nav menu-items hidden-xs hidden-sm">
              <li><a href="https://metacpan.org/about">About</a></li>
              <li><a href="https://metacpan.org/about/sponsors">Sponsor</a></li>
              <li><a href="https://grep.metacpan.org/">grep::cpan</a></li>
              <li><a href="https://metacpan.org/recent">Recent</a></li>
              <li><a href="https://metacpan.org/about/faq">FAQ</a></li>
              <li><a href="https://metacpan.org/tools">Tools</a></li>
              <li><a href="https://fastapi.metacpan.org/">API</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <button type="button" class="searchbar-btn visible-xs visible-sm">
                    <i class="fa fa-search button-fa-icon"></i>
                </button>
                <form action="https://metacpan.org/search" class="searchbar-form visible-md visible-lg search-form form-horizontal">
                   <input type="hidden" name="size" id="metacpan_search-size" value="20">
                  <div class="form-group">
                      <div class="search-group">
                        <i class="fa fa-search"></i>
                        <input type="text" name="q" placeholder="Search the CPAN" size="41" autocorrect="off" autocapitalize="off" spellcheck="false" id="metacpan_search-input" class="form-control" value="">
                      </div>
                  </div>
                </form>
                    <li class="icon-slidepanel visible-xs visible-sm">
                      <button data-toggle="slidepanel" data-target=".slidepanel">
                        <span class="button-fa-icon">
                          <i class="fa fa-bars slidepanel-open"></i>
                          <i class="fa fa-times slidepanel-close"></i>
                        </span>
                      </button>
                    </li>
                <form action="https://metacpan.org/account/logout" method="POST" id="metacpan-logout"></form>
                <li class="dropdown logged_in" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon logged-in-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="https://metacpan.org/account/identities">Identities</a></li>
                        <li><a href="https://metacpan.org/account/profile">Profile</a></li>
                        <li><a href="https://metacpan.org/account/favorite/list">Favorites</a></li>
                        <li>
                            <a href="./File::Copy::Recursive.html#" type="button" onclick="$('#metacpan-logout').submit(); return false">
                              Logout
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_out" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li>
                            <a href="https://metacpan.org/login/github">
                                <i class="fab fa-github fa-fw"></i>
                                GitHub
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/twitter">
                                <i class="fab fa-twitter fa-fw"></i>
                                Twitter
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/google">
                                <i class="fab fa-google fa-fw"></i>
                                Google
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_placeholder">
                    <button>
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                    </button>
                </li>
            </ul>
        </nav>
        <div class="page-content ">
          <!--
          <div class="top-notify-banner">
            <i class="fas fa-info-circle"></i>
          </div>
          -->
          <nav class="sidebar">
            <div class="slidepanel">
              <ul class="nav-list ">
    <li class="nav-header no-margin-top">
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The date that this version of File-Copy-Recursive was released.">
      <span class="relatize">23 Jul 2019 14:38:13 UTC</span>
    </li>
  <li>
    Distribution: <a href="https://metacpan.org/dist/File-Copy-Recursive">File-Copy-Recursive</a>
  </li>
  <li>
    Module version: 0.45
  </li>
  <li>
    <a data-keyboard-shortcut="g s" href="https://metacpan.org/dist/File-Copy-Recursive/source/lib/File/Copy/Recursive.pm">Source</a>
    (<a href="https://metacpan.org/dist/File-Copy-Recursive/source/lib/File/Copy/Recursive.pm?raw=1">raw</a>)
  </li>
  <li>
    <a data-keyboard-shortcut="g b" href="https://metacpan.org/dist/File-Copy-Recursive/source/lib/File/Copy">Browse</a>
    (<a href="https://metacpan.org/dist/File-Copy-Recursive/source/lib/File/Copy?raw=1">raw</a>)
  </li>
    <li>
      <a data-keyboard-shortcut="g c" href="https://metacpan.org/dist/File-Copy-Recursive/changes">Changes</a>
    </li>
    <li>
      <a class="nopopup" href="https://metacpan.org/dist/File-Copy-Recursive/contribute">How to Contribute</a>
    </li>
    <li>
        <a rel="noopener nofollow" data-keyboard-shortcut="g r" href="https://github.com/drmuey/p5-File-Copy-Recursive">Repository</a>
    </li>
    <li>
      <a rel="noopener nofollow" data-keyboard-shortcut="g i" href="https://github.com/drmuey/p5-File-Copy-Recursive/issues">Issues</a>
      (12)
    </li>
    <li>
      <a rel="noopener nofollow" href="http://matrix.cpantesters.org/?dist=File-Copy-Recursive+0.45" title="Matrix">Testers</a>
        <span title="(pass / fail / na)">(<a rel="noopener nofollow" href="https://www.cpantesters.org/distro/F/File-Copy-Recursive.html?oncpan=1&amp;distmat=1&amp;version=0.45&amp;grade=2" style="color: #090">8025</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/F/File-Copy-Recursive.html?oncpan=1&amp;distmat=1&amp;version=0.45&amp;grade=3" style="color: #900">284</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/F/File-Copy-Recursive.html?oncpan=1&amp;distmat=1&amp;version=0.45&amp;grade=4">0</a>)</span>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpants.cpanauthors.org/release/DMUEY/File-Copy-Recursive-0.45">Kwalitee</a>
    </li>
    <li>
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The # people with an indexing permission on File-Copy-Recursive who have released something to CPAN in the last 2 years (i.e. the # people likely able to release critical fixes in a timely manner)">
      Bus factor: 0
      </div>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpancover.com/latest/File-Copy-Recursive-0.45/index.html">68.20% Coverage </a>
    </li>
    <li>
      License: perl_5
    </li>
    <li class="nav-header">Activity</li>
    <li>
<div class="activity-graph">
    <img src="https://metacpan.org/dist/File-Copy-Recursive/activity.svg?res=month" />
    <div class="comment">24 month</div>
</div>
    </li>
    <li class="nav-header">Tools</li>
    <li>
      <a itemprop="downloadUrl" href="https://cpan.metacpan.org/authors/id/D/DM/DMUEY/File-Copy-Recursive-0.45.tar.gz">
      Download (<span itemprop="fileSize">18.8KB</span>)</a>
    </li>
    <li>
      <a href="https://explorer.metacpan.org/?url=%2Fmodule%2FDMUEY%2FFile-Copy-Recursive-0.45%2Flib%2FFile%2FCopy%2FRecursive.pm">
        MetaCPAN Explorer
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/File-Copy-Recursive/permissions">
        Permissions
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/File-Copy-Recursive/releases.rss">
        Subscribe to distribution
      </a>
    </li>
    <li>
      <button class="btn btn-link" data-toggle="modal" data-target="#metacpan_install-instructions-dialog">
        Install Instructions
      </button>
    </li>
    <li>
      <form action="https://metacpan.org/search">
        <input type="hidden" name="q" value="dist:File-Copy-Recursive">
        <input type="search" name="q" placeholder="Search distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
      </form>
    </li>
    <li>
      <form action="https://grep.metacpan.org/search">
        <input type="hidden" name="qd" value="File-Copy-Recursive">
        <input type="hidden" name="source" value="metacpan">
        <input type="search" name="q" placeholder="grep distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
     </form>
    </li>
    <li class="version-jump">
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/File/Copy/Recursive.pm&#39;" class="form-control tool-bar-form">
  <option disabled selected>Jump to version</option>
<option
  disabled
  value="DMUEY/File-Copy-Recursive-0.45"
>0.45
  (DMUEY on 2019-07-23)</option>
<optgroup label="BackPAN">'
<option
  
  value="DMUEY/File-Copy-Recursive-0.44"
>0.44
  (DMUEY on 2018-04-24)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.43"
>0.43
  (DMUEY on 2018-04-21)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.42"
>0.42
  (DMUEY on 2018-04-21)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.41"
>0.41
  (DMUEY on 2018-04-19)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.40"
>0.40
  (DMUEY on 2018-01-16)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.39"
>0.39
  (DMUEY on 2017-12-29)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.38"
>0.38
  (DMUEY on 2008-12-07)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.37"
>0.37
  (DMUEY on 2008-10-09)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.36"
>0.36
  (DMUEY on 2008-04-16)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.35"
>0.35
  (DMUEY on 2007-08-27)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.34"
>0.34
  (DMUEY on 2007-08-21)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.33"
>0.33
  (DMUEY on 2007-05-10)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.32"
>0.32
  (DMUEY on 2007-05-10)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.31"
>0.31
  (DMUEY on 2007-02-27)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.30"
>0.30
  (DMUEY on 2006-12-08)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.29"
>0.29
  (DMUEY on 2006-10-31)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.28"
>0.28
  (DMUEY on 2006-09-07)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.27"
>0.27
  (DMUEY on 2006-09-06)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.26"
>0.26
  (DMUEY on 2006-09-06)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.25"
>0.25
  (DMUEY on 2006-07-03)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.24"
>0.24
  (DMUEY on 2006-06-22)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.23"
>0.23
  (DMUEY on 2006-06-01)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.22"
>0.22
  (DMUEY on 2006-05-11)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.21"
>0.21
  (DMUEY on 2006-04-24)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.20"
>0.20
  (DMUEY on 2006-04-11)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.19"
>0.19
  (DMUEY on 2006-02-27)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.18"
>0.18
  (DMUEY on 2006-01-29)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.17"
>0.17
  (DMUEY on 2006-01-26)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.16"
>0.16
  (DMUEY on 2005-08-29)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.15"
>0.15
  (DMUEY on 2005-08-26)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.14"
>0.14
  (DMUEY on 2005-08-25)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.13"
>0.13
  (DMUEY on 2005-08-24)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.12"
>0.12
  (DMUEY on 2005-08-24)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.11"
>0.11
  (DMUEY on 2005-08-22)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.10"
>0.10
  (DMUEY on 2005-08-06)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.09"
>0.09
  (DMUEY on 2005-08-06)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.08"
>0.08
  (DMUEY on 2005-07-29)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.07"
>0.07
  (DMUEY on 2005-07-19)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.06"
>0.06
  (DMUEY on 2005-04-15)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.05"
>0.05
  (DMUEY on 2005-03-04)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.04"
>0.04
  (DMUEY on 2005-01-19)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.03"
>0.03
  (DMUEY on 2005-01-18)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.02"
>0.02
  (DMUEY on 2004-12-07)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.01"
>0.01
  (DMUEY on 2004-12-07)</option>
</optgroup>
</select>
    </li>
    <li class="version-diff">
<select onchange="document.location.href='/release/DMUEY/File-Copy-Recursive-0.45/diff/' + encodeURIComponent(this.value) + '/lib/File/Copy/Recursive.pm'
" class="form-control tool-bar-form">
  <option disabled selected>Diff with version</option>
<option
  disabled
  value="DMUEY/File-Copy-Recursive-0.45"
>0.45
  (DMUEY on 2019-07-23)</option>
<optgroup label="BackPAN">'
<option
  
  value="DMUEY/File-Copy-Recursive-0.44"
>0.44
  (DMUEY on 2018-04-24)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.43"
>0.43
  (DMUEY on 2018-04-21)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.42"
>0.42
  (DMUEY on 2018-04-21)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.41"
>0.41
  (DMUEY on 2018-04-19)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.40"
>0.40
  (DMUEY on 2018-01-16)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.39"
>0.39
  (DMUEY on 2017-12-29)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.38"
>0.38
  (DMUEY on 2008-12-07)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.37"
>0.37
  (DMUEY on 2008-10-09)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.36"
>0.36
  (DMUEY on 2008-04-16)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.35"
>0.35
  (DMUEY on 2007-08-27)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.34"
>0.34
  (DMUEY on 2007-08-21)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.33"
>0.33
  (DMUEY on 2007-05-10)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.32"
>0.32
  (DMUEY on 2007-05-10)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.31"
>0.31
  (DMUEY on 2007-02-27)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.30"
>0.30
  (DMUEY on 2006-12-08)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.29"
>0.29
  (DMUEY on 2006-10-31)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.28"
>0.28
  (DMUEY on 2006-09-07)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.27"
>0.27
  (DMUEY on 2006-09-06)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.26"
>0.26
  (DMUEY on 2006-09-06)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.25"
>0.25
  (DMUEY on 2006-07-03)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.24"
>0.24
  (DMUEY on 2006-06-22)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.23"
>0.23
  (DMUEY on 2006-06-01)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.22"
>0.22
  (DMUEY on 2006-05-11)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.21"
>0.21
  (DMUEY on 2006-04-24)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.20"
>0.20
  (DMUEY on 2006-04-11)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.19"
>0.19
  (DMUEY on 2006-02-27)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.18"
>0.18
  (DMUEY on 2006-01-29)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.17"
>0.17
  (DMUEY on 2006-01-26)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.16"
>0.16
  (DMUEY on 2005-08-29)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.15"
>0.15
  (DMUEY on 2005-08-26)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.14"
>0.14
  (DMUEY on 2005-08-25)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.13"
>0.13
  (DMUEY on 2005-08-24)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.12"
>0.12
  (DMUEY on 2005-08-24)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.11"
>0.11
  (DMUEY on 2005-08-22)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.10"
>0.10
  (DMUEY on 2005-08-06)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.09"
>0.09
  (DMUEY on 2005-08-06)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.08"
>0.08
  (DMUEY on 2005-07-29)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.07"
>0.07
  (DMUEY on 2005-07-19)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.06"
>0.06
  (DMUEY on 2005-04-15)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.05"
>0.05
  (DMUEY on 2005-03-04)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.04"
>0.04
  (DMUEY on 2005-01-19)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.03"
>0.03
  (DMUEY on 2005-01-18)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.02"
>0.02
  (DMUEY on 2004-12-07)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.01"
>0.01
  (DMUEY on 2004-12-07)</option>
</optgroup>
</select>
    </li>

    <li>
<ul class="dependencies">
  <li class="nav-header">Dependencies</li>
  <li><a href="https://metacpan.org/pod/Cwd" title="Cwd" class="ellipsis">Cwd</a></li>
  <li><a href="https://metacpan.org/pod/File::Copy" title="File::Copy" class="ellipsis">File::Copy</a></li>
  <li><a href="https://metacpan.org/pod/File::Glob" title="File::Glob" class="ellipsis">File::Glob</a></li>
  <li><a href="https://metacpan.org/pod/File::Spec" title="File::Spec" class="ellipsis">File::Spec</a></li>
  <li>
    <hr>
  </li>
  <li>
    <a href="https://metacpan.org/module/File::Copy::Recursive/requires">Reverse dependencies</a>
  </li>
  <li>
    <a href="http://deps.cpantesters.org/?module=File%3A%3ACopy%3A%3ARecursive">CPAN Testers List</a>
  </li>
  <li>
    <a href="https://cpandeps.grinnz.com/?dist=File-Copy-Recursive">Dependency graph</a>
  </li>
</ul>
    </li>
    <li class="nav-header">Permalinks</li>
    <li>
      <a href="https://metacpan.org/release/DMUEY/File-Copy-Recursive-0.45/view/lib/File/Copy/Recursive.pm">This version</a>
    </li>
    <li>
      <a href="./File::Copy::Recursive.html">Latest version</a>
    </li>
    <li>
<div class="plussers">
<div class="nav-header">++ed by:</div>
<div>
<a class="display-all" href="https://metacpan.org/author/KEEDI"><img src="https://www.gravatar.com/avatar/95f905a7a4ccc573c711e9d264c0fde8?d=identicon&amp;s=20" title="KEEDI" alt="KEEDI"></a>
<a class="display-all" href="https://metacpan.org/author/BEROV"><img src="https://www.gravatar.com/avatar/eae0eb4092a9f63426c13408e343b803?d=identicon&amp;s=20" title="BEROV" alt="BEROV"></a>
<a class="display-all" href="https://metacpan.org/author/ILUX"><img src="https://www.gravatar.com/avatar/1cd0eea5e6ca13346060bb9d2c1e286b?d=identicon&amp;s=20" title="ILUX" alt="ILUX"></a>
<a class="display-all" href="https://metacpan.org/author/JETEVE"><img src="https://www.gravatar.com/avatar/c4e14b12510fe0f58bbec64d47ed5816?d=identicon&amp;s=20" title="JETEVE" alt="JETEVE"></a>
<a class="display-all" href="https://metacpan.org/author/TOKUHIROM"><img src="https://www.gravatar.com/avatar/70f90c6a0bcd84348b02309babc98684?d=identicon&amp;s=20" title="TOKUHIROM" alt="TOKUHIROM"></a>
</div>
<!-- Display counts of plussers-->
<div>
    <a href="https://metacpan.org/dist/File-Copy-Recursive/plussers">10 PAUSE users</a>
</div>
<div>
    7 non-PAUSE users
</div>
</div>
    </li>
    <li>
<div id="metacpan_contributors">
  <div>
    <button class="btn-link"
      onclick="$(this).hide(); $('#metacpan_contributors ul').slideDown(); return false;"
    >and 1 contributors</button>
  </div>
  <ul style="display: none">
    <li class="contributor"
    >
      Daniel Muey &lt;http://drmuey.com/cpan_contact.pl&gt;
    </li>
  </ul>
</div>
    </li>
              </ul>
            </div>
          </nav>
          <div class="content-navigation">
<div class="breadcrumbs">
  <span>
    <a data-keyboard-shortcut="g a" rel="author" href="https://metacpan.org/author/DMUEY" class="author-name">Daniel Muey</a>
  </span>
  <span>&nbsp;/&nbsp;</span>
  <div class="release dist-release status-latest maturity-released">
    <span class="dropdown"><b class="caret"></b></span>
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/File/Copy/Recursive.pm&#39;" class="">
<option
  selected
  value="DMUEY/File-Copy-Recursive-0.45"
>0.45
  (DMUEY on 2019-07-23)</option>
<optgroup label="BackPAN">'
<option
  
  value="DMUEY/File-Copy-Recursive-0.44"
>0.44
  (DMUEY on 2018-04-24)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.43"
>0.43
  (DMUEY on 2018-04-21)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.42"
>0.42
  (DMUEY on 2018-04-21)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.41"
>0.41
  (DMUEY on 2018-04-19)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.40"
>0.40
  (DMUEY on 2018-01-16)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.39"
>0.39
  (DMUEY on 2017-12-29)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.38"
>0.38
  (DMUEY on 2008-12-07)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.37"
>0.37
  (DMUEY on 2008-10-09)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.36"
>0.36
  (DMUEY on 2008-04-16)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.35"
>0.35
  (DMUEY on 2007-08-27)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.34"
>0.34
  (DMUEY on 2007-08-21)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.33"
>0.33
  (DMUEY on 2007-05-10)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.32"
>0.32
  (DMUEY on 2007-05-10)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.31"
>0.31
  (DMUEY on 2007-02-27)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.30"
>0.30
  (DMUEY on 2006-12-08)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.29"
>0.29
  (DMUEY on 2006-10-31)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.28"
>0.28
  (DMUEY on 2006-09-07)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.27"
>0.27
  (DMUEY on 2006-09-06)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.26"
>0.26
  (DMUEY on 2006-09-06)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.25"
>0.25
  (DMUEY on 2006-07-03)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.24"
>0.24
  (DMUEY on 2006-06-22)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.23"
>0.23
  (DMUEY on 2006-06-01)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.22"
>0.22
  (DMUEY on 2006-05-11)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.21"
>0.21
  (DMUEY on 2006-04-24)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.20"
>0.20
  (DMUEY on 2006-04-11)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.19"
>0.19
  (DMUEY on 2006-02-27)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.18"
>0.18
  (DMUEY on 2006-01-29)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.17"
>0.17
  (DMUEY on 2006-01-26)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.16"
>0.16
  (DMUEY on 2005-08-29)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.15"
>0.15
  (DMUEY on 2005-08-26)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.14"
>0.14
  (DMUEY on 2005-08-25)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.13"
>0.13
  (DMUEY on 2005-08-24)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.12"
>0.12
  (DMUEY on 2005-08-24)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.11"
>0.11
  (DMUEY on 2005-08-22)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.10"
>0.10
  (DMUEY on 2005-08-06)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.09"
>0.09
  (DMUEY on 2005-08-06)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.08"
>0.08
  (DMUEY on 2005-07-29)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.07"
>0.07
  (DMUEY on 2005-07-19)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.06"
>0.06
  (DMUEY on 2005-04-15)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.05"
>0.05
  (DMUEY on 2005-03-04)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.04"
>0.04
  (DMUEY on 2005-01-19)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.03"
>0.03
  (DMUEY on 2005-01-18)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.02"
>0.02
  (DMUEY on 2004-12-07)</option>
<option
  
  value="DMUEY/File-Copy-Recursive-0.01"
>0.01
  (DMUEY on 2004-12-07)</option>
</optgroup>
</select>
    <a data-keyboard-shortcut="g d" class="release-name" href="https://metacpan.org/dist/File-Copy-Recursive">File-Copy-Recursive-0.45</a>
  </div>
<span class="river-gauge-gauge">
  <svg width="24px"
       height="15px"
       version="1.1"
       xmlns="http://www.w3.org/2000/svg"
       xmlns:xlink="http://www.w3.org/1999/xlink">

    <g>
      <title>        River stage four &#10;
          • 129 direct dependents &#10;          • 4110 total dependents
      </title>

      <rect x="0"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="5"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="10"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="15"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="20"  y="0" width="4" height="15" fill="#e4e2e2" />
    </g>
  </svg>

</span>
<div id="File-Copy-Recursive-fav" class="logged_in">
<form action="https://metacpan.org/account/favorite/add" style="display: inline" onsubmit="return favDistribution(this)">
    <input type="hidden" name="remove" value="0">
    <input type="hidden" name="release" value="File-Copy-Recursive-0.45">
    <input type="hidden" name="author" value="DMUEY">
    <input type="hidden" name="distribution" value="File-Copy-Recursive">
    <button type="submit" class="favorite highlight"><span>17</span> ++</button>
</form>
</div>
<div class="logged_out">
<a href="./File::Copy::Recursive.html" onclick="alert('Please sign in to add favorites'); return false" class="favorite highlight">
<span>17</span> ++</a>
</div>
   / <span>File::Copy::Recursive</span>
</div>
          </div>
          <main class="content">


<nav class="toc">
  <div class="toc-header"><strong>Contents</strong></div>
<ul>
  <li><a href="./File::Copy::Recursive.html#NAME">NAME</a></li>
  <li><a href="./File::Copy::Recursive.html#SYNOPSIS">SYNOPSIS</a></li>
  <li><a href="./File::Copy::Recursive.html#DESCRIPTION">DESCRIPTION</a></li>
  <li><a href="./File::Copy::Recursive.html#EXPORT">EXPORT</a>
    <ul>
      <li><a href="./File::Copy::Recursive.html#fcopy()">fcopy()</a></li>
      <li><a href="./File::Copy::Recursive.html#dircopy()">dircopy()</a></li>
      <li><a href="./File::Copy::Recursive.html#rcopy()">rcopy()</a></li>
      <li><a href="./File::Copy::Recursive.html#rcopy_glob()">rcopy_glob()</a></li>
      <li><a href="./File::Copy::Recursive.html#fmove()">fmove()</a></li>
      <li><a href="./File::Copy::Recursive.html#dirmove()">dirmove()</a></li>
      <li><a href="./File::Copy::Recursive.html#rmove()">rmove()</a></li>
      <li><a href="./File::Copy::Recursive.html#rmove_glob()">rmove_glob()</a>
        <ul>
          <li><a href="./File::Copy::Recursive.html#$RemvBase">$RemvBase</a>
            <ul>
              <li><a href="./File::Copy::Recursive.html#$ForcePth">$ForcePth</a></li>
            </ul>
          </li>
        </ul>
      </li>
      <li><a href="./File::Copy::Recursive.html#Creating-and-Removing-Paths">Creating and Removing Paths</a>
        <ul>
          <li><a href="./File::Copy::Recursive.html#$NoFtlPth">$NoFtlPth</a></li>
          <li><a href="./File::Copy::Recursive.html#$DirPerms">$DirPerms</a></li>
          <li><a href="./File::Copy::Recursive.html#Path-functions">Path functions</a>
            <ul>
              <li><a href="./File::Copy::Recursive.html#pathrm()">pathrm()</a></li>
              <li><a href="./File::Copy::Recursive.html#pathempty()">pathempty()</a></li>
              <li><a href="./File::Copy::Recursive.html#pathmk()">pathmk()</a></li>
              <li><a href="./File::Copy::Recursive.html#pathrmdir()">pathrmdir()</a></li>
            </ul>
          </li>
        </ul>
      </li>
      <li><a href="./File::Copy::Recursive.html#Preserving-Mode">Preserving Mode</a></li>
      <li><a href="./File::Copy::Recursive.html#Managing-Depth">Managing Depth</a></li>
      <li><a href="./File::Copy::Recursive.html#SymLinks">SymLinks</a></li>
      <li><a href="./File::Copy::Recursive.html#Removing-existing-target-file-or-directory-before-copying.">Removing existing target file or directory before copying.</a></li>
      <li><a href="./File::Copy::Recursive.html#Turning-off-stat()-check">Turning off stat() check</a></li>
      <li><a href="./File::Copy::Recursive.html#Emulating-cp-rf-dir1/-dir2/">Emulating cp -rf dir1/ dir2/</a></li>
      <li><a href="./File::Copy::Recursive.html#Allowing-Copy-Loops">Allowing Copy Loops</a></li>
    </ul>
  </li>
  <li><a href="./File::Copy::Recursive.html#SEE-ALSO">SEE ALSO</a></li>
  <li><a href="./File::Copy::Recursive.html#TO-DO">TO DO</a></li>
  <li><a href="./File::Copy::Recursive.html#AUTHOR">AUTHOR</a></li>
  <li><a href="./File::Copy::Recursive.html#COPYRIGHT-AND-LICENSE">COPYRIGHT AND LICENSE</a></li>
</ul></nav>
<div class="pod anchors">
<h1 id="NAME">NAME</h1>

<p>File::Copy::Recursive - Perl extension for recursively copying files and directories</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<pre><code>  use File::Copy::Recursive qw(fcopy rcopy dircopy fmove rmove dirmove);

  fcopy($orig,$new[,$buf]) or die $!;
  rcopy($orig,$new[,$buf]) or die $!;
  dircopy($orig,$new[,$buf]) or die $!;

  fmove($orig,$new[,$buf]) or die $!;
  rmove($orig,$new[,$buf]) or die $!;
  dirmove($orig,$new[,$buf]) or die $!;
  
  rcopy_glob(&quot;orig/stuff-*&quot;, $trg [, $buf]) or die $!;
  rmove_glob(&quot;orig/stuff-*&quot;, $trg [,$buf]) or die $!;</code></pre>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p>This module copies and moves directories recursively (or single files, well... singley) to an optional depth and attempts to preserve each file or directory&#39;s mode.</p>

<h1 id="EXPORT">EXPORT</h1>

<p>None by default. But you can export all the functions as in the example above and the path* functions if you wish.</p>

<h2 id="fcopy()"><a id="fcopy"></a>fcopy()</h2>

<p>This function uses File::Copy&#39;s copy() function to copy a file but not a directory. Any directories are recursively created if need be. One difference to File::Copy::copy() is that fcopy attempts to preserve the mode (see Preserving Mode below) The optional $buf in the synopsis is the same as File::Copy::copy()&#39;s 3rd argument. This function returns the same as File::Copy::copy() in scalar context and 1,0,0 in list context to accomodate rcopy()&#39;s list context on regular files. (See below for more info)</p>

<h2 id="dircopy()"><a id="dircopy"></a>dircopy()</h2>

<p>This function recursively traverses the $orig directory&#39;s structure and recursively copies it to the $new directory. $new is created if necessary (multiple non existent directories is ok (i.e. foo/bar/baz). The script logically and portably creates all of them if necessary). It attempts to preserve the mode (see Preserving Mode below) and by default it copies all the way down into the directory (see Managing Depth, below). If a directory is not specified it croaks just like fcopy croaks if its not a file that is specified.</p>

<p>This function returns true or false: for true in scalar context it returns the number of files and directories copied, whereas in list context it returns the number of files and directories, number of directories only, depth level traversed.</p>

<pre><code>  my $num_of_files_and_dirs = dircopy($orig,$new);
  my($num_of_files_and_dirs,$num_of_dirs,$depth_traversed) = dircopy($orig,$new);
  </code></pre>

<p>Normally it stops and returns if a copy fails. To continue on regardless, set $File::Copy::Recursive::SkipFlop to true.</p>

<pre><code>    local $File::Copy::Recursive::SkipFlop = 1;</code></pre>

<p>That way it will copy everythging it can in a directory and won&#39;t stop because of permissions, etc...</p>

<h2 id="rcopy()"><a id="rcopy"></a>rcopy()</h2>

<p>This function will allow you to specify a file *or* a directory. It calls fcopy() if you passed file and dircopy() if you passed a directory. If you call rcopy() (or fcopy() for that matter) on a file in list context, the values will be 1,0,0 since no directories and no depth are used. This is important because if it&#39;s a directory in list context and there is only the initial directory the return value is 1,1,1.</p>

<h2 id="rcopy_glob()"><a id="rcopy_glob"></a>rcopy_glob()</h2>

<p>This function lets you specify a pattern suitable for perl&#39;s File::Glob::bsd_glob() as the first argument. Subsequently each path returned by perl&#39;s File::Glob::bsd_glob() gets rcopy()ied.</p>

<p>It returns and array whose items are array refs that contain the return value of each rcopy() call.</p>

<p>It forces behavior as if $File::Copy::Recursive::CPRFComp is true.</p>

<h2 id="fmove()"><a id="fmove"></a>fmove()</h2>

<p>Copies the file then removes the original. You can manage the path the original file is in according to $RemvBase.</p>

<h2 id="dirmove()"><a id="dirmove"></a>dirmove()</h2>

<p>Uses dircopy() to copy the directory then removes the original. You can manage the path the original directory is in according to $RemvBase.</p>

<h2 id="rmove()"><a id="rmove"></a>rmove()</h2>

<p>Like rcopy() but calls fmove() or dirmove() instead.</p>

<h2 id="rmove_glob()"><a id="rmove_glob"></a>rmove_glob()</h2>

<p>Like rcopy_glob() but calls rmove() instead of rcopy()</p>

<h3 id="$RemvBase"><a id="RemvBase"></a>$RemvBase</h3>

<p>Default is false. When set to true the *move() functions will not only attempt to remove the original file or directory but will remove the given path it is in.</p>

<p>So if you:</p>

<pre><code>   rmove(&#39;foo/bar/baz&#39;, &#39;/etc/&#39;);
   # &quot;baz&quot; is removed from foo/bar after it is successfully copied to /etc/
   
   local $File::Copy::Recursive::Remvbase = 1;
   rmove(&#39;foo/bar/baz&#39;,&#39;/etc/&#39;);
   # if baz is successfully copied to /etc/ :
   # first &quot;baz&quot; is removed from foo/bar
   # then &quot;foo/bar is removed via pathrm()</code></pre>

<h4 id="$ForcePth"><a id="ForcePth"></a>$ForcePth</h4>

<p>Default is false. When set to true it calls pathempty() before any directories are removed to empty the directory so it can be rmdir()&#39;ed when $RemvBase is in effect.</p>

<h2 id="Creating-and-Removing-Paths"><a id="Creating"></a>Creating and Removing Paths</h2>

<h3 id="$NoFtlPth"><a id="NoFtlPth"></a>$NoFtlPth</h3>

<p>Default is false. If set to true rmdir(), mkdir(), and pathempty() calls in pathrm() and pathmk() do not return() on failure.</p>

<p>If its set to true they just silently go about their business regardless. This isn&#39;t a good idea but it&#39;s there if you want it.</p>

<h3 id="$DirPerms"><a id="DirPerms"></a>$DirPerms</h3>

<p>Mode to pass to any mkdir() calls. Defaults to 0777 as per umask()&#39;s POD. Explicitly having this allows older perls to be able to use FCR and might add a bit of flexibility for you.</p>

<p>Any value you set it to should be suitable for oct().</p>

<h3 id="Path-functions"><a id="Path"></a>Path functions</h3>

<p>These functions exist solely because they were necessary for the move and copy functions to have the features they do and not because they are of themselves the purpose of this module. That being said, here is how they work so you can understand how the copy and move functions work and use them by themselves if you wish.</p>

<h4 id="pathrm()"><a id="pathrm"></a>pathrm()</h4>

<p>Removes a given path recursively. It removes the *entire* path so be careful!!!</p>

<p>Returns 2 if the given path is not a directory.</p>

<pre><code>  File::Copy::Recursive::pathrm(&#39;foo/bar/baz&#39;) or die $!;
  # foo no longer exists</code></pre>

<p>Same as:</p>

<pre><code>  rmdir &#39;foo/bar/baz&#39; or die $!;
  rmdir &#39;foo/bar&#39; or die $!;
  rmdir &#39;foo&#39; or die $!;</code></pre>

<p>An optional second argument makes it call pathempty() before any rmdir()&#39;s when set to true.</p>

<pre><code>  File::Copy::Recursive::pathrm(&#39;foo/bar/baz&#39;, 1) or die $!;
  # foo no longer exists</code></pre>

<p>Same as:PFSCheck</p>

<pre><code>  File::Copy::Recursive::pathempty(&#39;foo/bar/baz&#39;) or die $!;
  rmdir &#39;foo/bar/baz&#39; or die $!;
  File::Copy::Recursive::pathempty(&#39;foo/bar/&#39;) or die $!;
  rmdir &#39;foo/bar&#39; or die $!;
  File::Copy::Recursive::pathempty(&#39;foo/&#39;) or die $!;
  rmdir &#39;foo&#39; or die $!;</code></pre>

<p>An optional third argument acts like $File::Copy::Recursive::NoFtlPth, again probably not a good idea.</p>

<h4 id="pathempty()"><a id="pathempty"></a>pathempty()</h4>

<p>Recursively removes the given directory&#39;s contents so it is empty. Returns 2 if the given argument is not a directory, 1 on successfully emptying the directory.</p>

<pre><code>   File::Copy::Recursive::pathempty($pth) or die $!;
   # $pth is now an empty directory</code></pre>

<h4 id="pathmk()"><a id="pathmk"></a>pathmk()</h4>

<p>Creates a given path recursively. Creates foo/bar/baz even if foo does not exist.</p>

<pre><code>   File::Copy::Recursive::pathmk(&#39;foo/bar/baz&#39;) or die $!;</code></pre>

<p>An optional second argument if true acts just like $File::Copy::Recursive::NoFtlPth, which means you&#39;d never get your die() if something went wrong. Again, probably a *bad* idea.</p>

<h4 id="pathrmdir()"><a id="pathrmdir"></a>pathrmdir()</h4>

<p>Same as rmdir() but it calls pathempty() first to recursively empty it first since rmdir can not remove a directory with contents. Just removes the top directory the path given instead of the entire path like pathrm(). Returns 2 if the given argument does not exist (i.e. it&#39;s already gone). Returns false if it exists but is not a directory.</p>

<h2 id="Preserving-Mode"><a id="Preserving"></a>Preserving Mode</h2>

<p>By default a quiet attempt is made to change the new file or directory to the mode of the old one. To turn this behavior off set $File::Copy::Recursive::KeepMode to false;</p>

<h2 id="Managing-Depth"><a id="Managing"></a>Managing Depth</h2>

<p>You can set the maximum depth a directory structure is recursed by setting: $File::Copy::Recursive::MaxDepth to a whole number greater than 0.</p>

<h2 id="SymLinks">SymLinks</h2>

<p>If your system supports symlinks then symlinks will be copied as symlinks instead of as the target file. Perl&#39;s symlink() is used instead of File::Copy&#39;s copy(). You can customize this behavior by setting $File::Copy::Recursive::CopyLink to a true or false value. It is already set to true or false depending on your system&#39;s support of symlinks so you can check it with an if statement to see how it will behave:</p>

<pre><code>    if($File::Copy::Recursive::CopyLink) {
        print &quot;Symlinks will be preserved\n&quot;;
    } else {
        print &quot;Symlinks will not be preserved because your system does not support it\n&quot;;
    }</code></pre>

<p>If symlinks are being copied you can set $File::Copy::Recursive::BdTrgWrn to true to make it carp when it copies a link whose target does not exist. It&#39;s false by default.</p>

<pre><code>    local $File::Copy::Recursive::BdTrgWrn  = 1;</code></pre>

<h2 id="Removing-existing-target-file-or-directory-before-copying."><a id="Removing"></a><a id="Removing-existing-target-file-or-directory-before-copying"></a>Removing existing target file or directory before copying.</h2>

<p>This can be done by setting $File::Copy::Recursive::RMTrgFil or $File::Copy::Recursive::RMTrgDir for file or directory behavior respectively.</p>

<p>0 = off (This is the default)</p>

<p>1 = carp() $! if removal fails</p>

<p>2 = return if removal fails</p>

<pre><code>    local $File::Copy::Recursive::RMTrgFil = 1;
    fcopy($orig, $target) or die $!;
    # if it fails it does warn() and keeps going

    local $File::Copy::Recursive::RMTrgDir = 2;
    dircopy($orig, $target) or die $!;
    # if it fails it does your &quot;or die&quot;</code></pre>

<p>This should be unnecessary most of the time but it&#39;s there if you need it :)</p>

<h2 id="Turning-off-stat()-check"><a id="Turning"></a><a id="Turning-off-stat--check"></a>Turning off stat() check</h2>

<p>By default the files or directories are checked to see if they are the same (i.e. linked, or two paths (absolute/relative or different relative paths) to the same file) by comparing the file&#39;s stat() info. It&#39;s a very efficient check that croaks if they are and shouldn&#39;t be turned off but if you must for some weird reason just set $File::Copy::Recursive::PFSCheck to a false value. (&quot;PFS&quot; stands for &quot;Physical File System&quot;)</p>

<h2 id="Emulating-cp-rf-dir1/-dir2/"><a id="Emulating"></a><a id="Emulating-cp-rf-dir1--dir2"></a>Emulating cp -rf dir1/ dir2/</h2>

<p>By default dircopy($dir1,$dir2) will put $dir1&#39;s contents right into $dir2 whether $dir2 exists or not.</p>

<p>You can make dircopy() emulate cp -rf by setting $File::Copy::Recursive::CPRFComp to true.</p>

<p>NOTE: This only emulates -f in the sense that it does not prompt. It does not remove the target file or directory if it exists. If you need to do that then use the variables $RMTrgFil and $RMTrgDir described in &quot;Removing existing target file or directory before copying&quot; above.</p>

<p>That means that if $dir2 exists it puts the contents into $dir2/$dir1 instead of $dir2 just like cp -rf. If $dir2 does not exist then the contents go into $dir2 like normal (also like cp -rf).</p>

<p>So assuming &#39;foo/file&#39;:</p>

<pre><code>    dircopy(&#39;foo&#39;, &#39;bar&#39;) or die $!;
    # if bar does not exist the result is bar/file
    # if bar does exist the result is bar/file

    $File::Copy::Recursive::CPRFComp = 1;
    dircopy(&#39;foo&#39;, &#39;bar&#39;) or die $!;
    # if bar does not exist the result is bar/file
    # if bar does exist the result is bar/foo/file</code></pre>

<p>You can also specify a star for cp -rf glob type behavior:</p>

<pre><code>    dircopy(&#39;foo/*&#39;, &#39;bar&#39;) or die $!;
    # if bar does not exist the result is bar/file
    # if bar does exist the result is bar/file

    $File::Copy::Recursive::CPRFComp = 1;
    dircopy(&#39;foo/*&#39;, &#39;bar&#39;) or die $!;
    # if bar does not exist the result is bar/file
    # if bar does exist the result is bar/file</code></pre>

<p>NOTE: The &#39;*&#39; is only like cp -rf foo/* and *DOES NOT EXPAND PARTIAL DIRECTORY NAMES LIKE YOUR SHELL DOES* (i.e. not like cp -rf fo* to copy foo/*).</p>

<h2 id="Allowing-Copy-Loops"><a id="Allowing"></a>Allowing Copy Loops</h2>

<p>If you want to allow:</p>

<pre><code>  cp -rf . foo/</code></pre>

<p>type behavior set $File::Copy::Recursive::CopyLoop to true.</p>

<p>This is false by default so that a check is done to see if the source directory will contain the target directory and croaks to avoid this problem.</p>

<p>If you ever find a situation where $CopyLoop = 1 is desirable let me know. (i.e. it&#39;s a bad bad idea but is there if you want it)</p>

<p>(Note: On Windows this was necessary since it uses stat() to determine sameness and stat() is essentially useless for this on Windows. The test is now simply skipped on Windows but I&#39;d rather have an actual reliable check if anyone in Microsoft land would care to share)</p>

<h1 id="SEE-ALSO"><a id="SEE"></a>SEE ALSO</h1>

<p><a href="https://metacpan.org/pod/File::Copy">File::Copy</a> <a href="https://metacpan.org/pod/File::Spec">File::Spec</a></p>

<h1 id="TO-DO"><a id="TO"></a>TO DO</h1>

<p>I am currently working on and reviewing some other modules to use in the new interface so we can lose the horrid globals as well as some other undesirable traits and also more easily make available some long standing requests.</p>

<p>Tests will be easier to do with the new interface and hence the testing focus will shift to the new interface and aim to be comprehensive.</p>

<p>The old interface will work, it just won&#39;t be brought in until it is used, so it will add no overhead for users of the new interface.</p>

<p>I&#39;ll add this after the latest version has been out for a while with no new features or issues found :)</p>

<h1 id="AUTHOR">AUTHOR</h1>

<p>Daniel Muey, <a href="http://drmuey.com/cpan_contact.pl">http://drmuey.com/cpan_contact.pl</a></p>

<h1 id="COPYRIGHT-AND-LICENSE"><a id="COPYRIGHT"></a>COPYRIGHT AND LICENSE</h1>

<p>Copyright 2004 by Daniel Muey</p>

<p>This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p></div>

<div id="metacpan_install-instructions-dialog" class="modal fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">Module Install Instructions</h4>
      </div>
      <div class="modal-body">
        <p>To install File::Copy::Recursive, copy and paste the appropriate command in to your terminal.</p>
        <p><a href="https://metacpan.org/dist/App-cpanminus/view/bin/cpanm">cpanm</a></p>
        <pre><code>cpanm File::Copy::Recursive</code></pre>
        <p><a href="https://metacpan.org/pod/CPAN">CPAN shell</a></p>
        <pre><code>perl -MCPAN -e shell
install File::Copy::Recursive</code></pre>
        <p>For more information on module installation, please visit <a href="https://www.cpan.org/modules/INSTALL.html">the detailed CPAN module installation guide</a>.</p>
      </div>
      <div class="modal-footer">
        <a href="./File::Copy::Recursive.html#" data-dismiss="modal" class="btn">Close</a>
      </div>
    </div>
  </div>
</div>
          </main>
          <div class="content-pagination">
          </div>
        </div>
        <footer class="footer">
          <div class="footer-container">
            <div class="footer-social">
              <div class="footer-link footer-logo">
                <a href="https://metacpan.org/">
                  <img src="https://metacpan.org/static/images/metacpan-logo.svg" alt="MetaCPAN" />
                </a>
              </div>
              <a class="footer-social-link" href="https://github.com/metacpan">
                <i class="fab fa-github-square"></i>
              </a>
              <a class="footer-social-link" href="https://fosstodon.org/@metacpan">
                <i class="fab fa-mastodon"></i>
              </a>
            </div>
            <div class="footer-links">
              <div class="footer-link">
                  <a href="https://metacpan.org/about">About</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/sponsors">Sponsor</a>
              </div>
              <div class="footer-link">
                  <a href="https://grep.metacpan.org">grep::cpan</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/recent">Recent</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/faq">FAQ</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/tools">Tools</a>
              </div>
              <div class="footer-link">
                  <a href="https://fastapi.metacpan.org/">API</a>
              </div>
              <div class="footer-link">
                  <a href="https://www.perl.org/">Perl.org</a>
              </div>
            </div>
            <div class="footer-sponsors">
              <a class="footer-sponsor-link" target="_blank" href="https://www.bytemark.co.uk/" rel="noopener">
                <img class="footer-sponsor-bytemark" src="https://metacpan.org/static/images/sponsors/bytemark_logo.svg" alt="Bytemark logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.liquidweb.com/" rel="noopener">
                <img class="footer-sponsor-liquidweb" src="https://metacpan.org/static/images/sponsors/liquidweb_logo.png" alt="liquidweb logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://deriv.com/careers/" rel="noopener">
                <img class="footer-sponsor-deriv" src="https://metacpan.org/static/images/sponsors/deriv.svg" alt="Deriv logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://geocode.xyz" rel="noopener">
                <img class="footer-sponsor-geocode" src="https://metacpan.org/static/images/sponsors/geocodelogo.svg" alt="Geocode logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.fastly.com/" rel="noopener">
                <img class="footer-sponsor-fastly" src="https://metacpan.org/static/images/sponsors/fastly_logo.svg" alt="Fastly logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://opencagedata.com" rel="noopener">
                <img class="footer-sponsor-opencage" src="https://metacpan.org/static/images/sponsors/open-cage.svg" alt="OpenCage logo">
              </a>
            </div>
          </div>
        </footer>
        <div class="modal fade" tabindex="-1" role="dialog" id="metacpan_keyboard-shortcuts">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Keyboard Shortcuts</h4>
              </div>
              <div class="modal-body row">
<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Global</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>s</kbd>
        </td>
        <td>Focus search bar</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>?</kbd>
        </td>
        <td>Bring up this help dialog</td>
      </tr>
    </tbody>
  </table>

  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>GitHub</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>p</kbd>
        </td>
        <td>Go to pull requests</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>go to github issues (only if github is preferred repository)</td>
      </tr>
    </tbody>
  </table>
</div>

<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>POD</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>a</kbd>
        </td>
        <td>Go to author</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>c</kbd>
        </td>
        <td>Go to changes</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>Go to issues</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>d</kbd>
        </td>
        <td>Go to dist</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>r</kbd>
        </td>
        <td>Go to repository/SCM</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>s</kbd>
        </td>
        <td>Go to source</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>b</kbd>
        </td>
        <td>Go to file browse</td>
      </tr>

    </tbody>
  </table>
</div>

<div class="col-md-12">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Search terms</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><em>module:</em> (e.g. <a href="https://metacpan.org/search?q=module%3APlugin">module:Plugin</a>)</td>
      </tr>
      <tr>
        <td><em>distribution:</em> (e.g. <a href="https://metacpan.org/search?q=distribution%3ADancer+auth">distribution:Dancer auth</a>)</td>
      </tr>
      <tr>
        <td><em>author:</em> (e.g. <a href="https://metacpan.org/search?q=author%3ASONGMU+Redis">author:SONGMU Redis</a>)</td>
      </tr>
      <tr>
        <td><em>version:</em> (e.g. <a href="https://metacpan.org/search?q=version%3A1.00">version:1.00</a>)</td>
      </tr>
    </tbody>
  </table>
</div>
              </div>
              <div class="modal-footer"></div>
            </div>
          </div>
        </div>
    </body>
</html>
